﻿var dataService = function () {
	var serviceBase = 'http://' + window.location.host + '/';
	var type = 'POST';
	var restEndPoint = '';
	var data = '';
	getTrainingItemsByTagId = function (tagId, callback) {
	    restEndPoint = serviceBase + 'Home/GetTrainingItemsByTagId';
	    data = "tagId=" + tagId;
	    makeAjaxCall(callback);
	};
	makeAjaxCall = function (callback) {
		$.ajax({
			type: "POST",
			url: restEndPoint,
			contentType: "application/x-www-form-urlencoded; charset=utf-8",
			dataType: "json",
			data: data,
			success: function (data) {
				callback(data);
			}
		});
	};
	return {
	    getTrainingItemsByTagId: getTrainingItemsByTagId
	}
}();
$(document).on("click", ".tagElem", function (e) {
	e.preventDefault();
	var tagId = $(this).data().tagid;
	dataService.getTrainingItemsByTag(tagId);
});
renderTrainingItemUI = function (data) {
    alert('done');
};